home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / blas / izamax.f < prev    next >
Text File  |  1997-01-29  |  988b  |  42 lines

  1.       integer function izamax(n,zx,incx)
  2. c
  3. c     finds the index of element having max. absolute value.
  4. c     jack dongarra, 1/15/85.
  5. c     modified 3/93 to return if incx .le. 0.
  6. c     modified 12/3/93, array(1) declarations changed to array(*)
  7. c
  8.       double complex zx(*)
  9.       double precision smax
  10.       integer i,incx,ix,n
  11.       double precision dcabs1
  12. c
  13.       izamax = 0
  14.       if( n.lt.1 .or. incx.le.0 )return
  15.       izamax = 1
  16.       if(n.eq.1)return
  17.       if(incx.eq.1)go to 20
  18. c
  19. c        code for increment not equal to 1
  20. c
  21.       ix = 1
  22.       smax = dcabs1(zx(1))
  23.       ix = ix + incx
  24.       do 10 i = 2,n
  25.          if(dcabs1(zx(ix)).le.smax) go to 5
  26.          izamax = i
  27.          smax = dcabs1(zx(ix))
  28.     5    ix = ix + incx
  29.    10 continue
  30.       return
  31. c
  32. c        code for increment equal to 1
  33. c
  34.    20 smax = dcabs1(zx(1))
  35.       do 30 i = 2,n
  36.          if(dcabs1(zx(i)).le.smax) go to 30
  37.          izamax = i
  38.          smax = dcabs1(zx(i))
  39.    30 continue
  40.       return
  41.       end
  42.